"""
Copyright 2009 Texas A&M University
 
Licensed under the Apache License, Version 2.0 (the "License"); you may not use 
this file except in compliance with the License. You may obtain a copy of the 
License at

http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software distributed 
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS OF ANY KIND, either express or implied. See the License for the 
specific language governing permissions and limitations under the License. 
"""

import zope.interface

class IInstance(zope.interface.Interface):
    """
    """
    
    def __len__(self):
        """This method should return the number of metadata objects tied to the
        IInstance object
        """
    
    def __iter__(self):
        """Return an object that implements the iterator interface and iterates
        over the metadata of this resource
        """
    
    def __eq__(self, other):
        """Check for equality based on getSource() and getIdentifier() """
    
    def __hash__(self):
        """Return a hash based on the tuple of getSource() and getIdentifier():
        i.e. return hash((self.getSource(),self.getIdentifier(),)) """
    
    def isActive(self):
        """Is this instance active """
      
    def getSource(self):
        """Return the source for this instance, where it was harvested from """
    
    def getIdentifier(self):
        """Return the identifier used on the source for this instance """
    
    def getMetadata(self):
        """Return an iterable container of objects that implement the IMetadata 
        interface.
        """
    
    def getLastModified(self):
        """Return a datetime object for the last time that this instance was 
        modified.
        """
    
    def getResource(self):
        """Return the resource that this instance represents """
    
class IMutableInstance(IInstance):
    """
    """
    
    def deactivate(self):
        """ Mark the object as no longer active """
    
    def activate(self):
        """ Mark the object as active """
    
    def append(self,metadata):
        """ Append new metadata to the instance """
    
    def remove(self,metadata):
        """ Remove a metadata object from the instance"""
    
    def removeFromSource(self,source):
        """ Remove all metadata for the object from a given source """
    
    def setResource(self, resource):
        """ Set the resource that this instance represents """